Modelling
# For indistinguishable Dyads
model_rows_fixed <- c(
'Intercept',
# '-- WITHIN PERSON MAIN EFFECTS --',
'persuasion_self_cw',
'persuasion_partner_cw',
'pressure_self_cw',
'pressure_partner_cw',
'pushing_self_cw',
'pushing_partner_cw',
'day',
'weartime_self_cw',
'support_self_cw',
'support_partner_cw',
'isWeekendWeekend',
'got_JITAI_selfJITAIreceived',
'skilled_supportDaysafterIntervention',
# '-- BETWEEN PERSON MAIN EFFECTS',
'persuasion_self_cb',
'persuasion_partner_cb',
'pressure_self_cb',
'pressure_partner_cb',
'pushing_self_cb',
'pushing_partner_cb',
'weartime_self_cb',
'studyGroupFirst3weeksinterventions',
'studyGrouplast3weeksinterventions'
)
model_rows_fixed_ordinal <- c(
model_rows_fixed[1],
'Intercept[1]',
'Intercept[2]',
'Intercept[3]',
'Intercept[4]',
'Intercept[5]',
model_rows_fixed[2:length(model_rows_fixed)]
)
model_rows_random <- c(
# '--------------',
# '-- RANDOM EFFECTS --',
'sd(Intercept)',
'sd(persuasion_self_cw)',
'sd(persuasion_partner_cw)',
'sd(pressure_self_cw)',
'sd(pressure_partner_cw)',
'sd(pushing_self_cw)',
'sd(pushing_partner_cw)',
# '-- CORRELATION STRUCTURE -- ',
'ar[1]',
'nu',
'shape',
'sderr',
'sigma'
)
model_rows_random_ordinal <- c(model_rows_random,'disc')
# For indistinguishable Dyads
model_rownames_fixed <- c(
'Intercept',
# '-- WITHIN PERSON MAIN EFFECTS --',
'Daily perceived persuasion target -> target',
'Daily perceived persuasion target -> agent',
'Daily perceived pressure target -> target',
'Daily perceived pressure target -> agent',
'Daily perceived pushing target -> target',
'Daily perceived pushing target -> agent',
'Day',
'Daily weartime',
'Daily perceived support target -> target',
'Daily perceived support target -> agent',
'Is a weekend',
'JITAI received',
'Days post skilled support intervention',
# '-- BETWEEN PERSON MAIN EFFECTS',
'Mean perceived persuasion target -> target',
'Mean Perceived persuasion target -> agent',
'Mean Perceived pressure target -> target',
'Mean Perceived pressure target -> agent',
'Mean Perceived pushing target -> target',
'Mean Perceived pushing target -> agent',
'Mean weartime',
'Difference study group 2',
'Difference study group 3'
)
model_rownames_fixed_ordinal <- c(
model_rownames_fixed[1],
'Intercept[1]',
'Intercept[2]',
'Intercept[3]',
'Intercept[4]',
'Intercept[5]',
model_rownames_fixed[2:length(model_rownames_fixed)]
)
model_rownames_random <- c(
# '--------------',
# '-- RANDOM EFFECTS --',
'sd(Intercept)',
'sd(Daily perceived persuasion target -> target)',
'sd(Daily perceived persuasion target -> agent)',
'sd(Daily perceived pressure target -> target)',
'sd(Daily perceived pressure target -> agent)',
'sd(Daily perceived pushing target -> target)',
'sd(Daily perceived pushing target -> agent)',
# '-- CORRELATION STRUCTURE -- ',
'ar[1]',
'nu',
'shape',
'sderr',
'sigma'
)
model_rownames_random_ordinal <- c(model_rownames_random,'disc')
rows_to_pack <- list(
"Within-Person Effects" = c(2,14),
"Between-Person Effects" = c(15,23),
"Random Effects" = c(24, 30),
"Additional Parameters" = c(31,35)
)
rows_to_pack_ordinal <- list(
"Intercepts" = c(1,6),
"Within-Person Effects" = c(2+5,14+5),
"Between-Person Effects" = c(15+5,23+5),
"Random Effects" = c(24+5, 30+5),
"Additional Parameters" = c(31+5,35+6)
)
Subjective MVPA
range(df_double$pa_sub, na.rm = T)
## [1] 0 720
hist(df_double$pa_sub, breaks = 100)

Modelling using the gaussian family fails. Due to the many zeros,
transformations won’t help estimating the models. We employ the negative
binomial family.
formula <- bf(
pa_sub ~
persuasion_self_cw + persuasion_partner_cw +
pressure_self_cw + pressure_partner_cw +
pushing_self_cw + pushing_partner_cw +
#barriers_self_cw +
support_self_cw + support_partner_cw +
#comf_self_cw + reas_self_cw +
isWeekend +
got_JITAI_self + skilled_support +
persuasion_self_cb + persuasion_partner_cb +
pressure_self_cb + pressure_partner_cb +
pushing_self_cb + pushing_partner_cb +
studyGroup +
day +
# Random effects
(persuasion_self_cw + persuasion_partner_cw +
pressure_self_cw + pressure_partner_cw +
pushing_self_cw + pushing_partner_cw | coupleID),
autocor = ~ ar(time = day, gr = coupleID:userID, p = 1)
)
prior1 <- c(
brms::set_prior("normal(0, 2.5)", class = "b"),
brms::set_prior("normal(0, 50)", class = "Intercept", lb = 0),
brms::set_prior("normal(0, 10)", class = "sd", group = "coupleID", lb = 0),
brms::set_prior("cauchy(0, 5)", class = "ar", lb = -1, ub = 1),
brms::set_prior("cauchy(0, 20)", class = "shape"),
brms::set_prior("cauchy(0, 10)", class='sderr')
)
#df_minimal <- df_double[, c("userID", all.vars(as.formula(formula)))]
pa_sub <- my_brm(
mi = use_mi,
imputed_data = implist,
formula = formula,
prior = prior1,
data = df_double,
family = brms::negbinomial(),
#control = list(adapt_delta = 0.99),
iter = 5000,
warmup = 2000,
chains = 4,
cores = 4,
seed = 7777,
file = file.path("models_cache_brms", "all_covariates_pa_sub")
)
pp_check(pa_sub, type='hist')
## Using 10 posterior draws for ppc type 'hist' by default.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

## Using 10 posterior draws for ppc type 'dens_overlay' by default.

##
## Computed from 12000 by 3732 log-likelihood matrix.
##
## Estimate SE
## elpd_loo -12058.6 177.5
## p_loo 42.3 3.3
## looic 24117.2 355.0
## ------
## MCSE of elpd_loo is NA.
## MCSE and ESS estimates assume MCMC draws (r_eff in [0.3, 1.8]).
##
## Pareto k diagnostic values:
## Count Pct. Min. ESS
## (-Inf, 0.7] (good) 3723 99.8% 543
## (0.7, 1] (bad) 9 0.2% <NA>
## (1, Inf) (very bad) 0 0.0% <NA>
## See help('pareto-k-diagnostic') for details.
plot(pa_sub, ask = FALSE)











summarize_brms(
pa_sub,
model_rows_fixed = model_rows_fixed,
model_rows_random = model_rows_random,
model_rownames_fixed = model_rownames_fixed,
model_rownames_random = model_rownames_random,
exponentiate = T) %>%
print_df(rows_to_pack = rows_to_pack)
|
|
IRR
|
l-95% CI
|
u-95% CI
|
Rhat
|
Bulk_ESS
|
Tail_ESS
|
|
Intercept
|
31.94*
|
20.58
|
50.03
|
1.001
|
1913.66
|
4895.73
|
|
Within-Person Effects
|
|
Daily perceived persuasion target -> target
|
1.03
|
0.91
|
1.16
|
1.000
|
11507.83
|
9256.28
|
|
Daily perceived persuasion target -> agent
|
0.99
|
0.88
|
1.12
|
1.000
|
11873.53
|
9022.10
|
|
Daily perceived pressure target -> target
|
1.22
|
0.92
|
1.66
|
1.000
|
13031.30
|
8793.75
|
|
Daily perceived pressure target -> agent
|
0.93
|
0.72
|
1.25
|
1.000
|
10896.75
|
8513.11
|
|
Daily perceived pushing target -> target
|
1.05
|
0.89
|
1.24
|
1.000
|
12935.56
|
8917.69
|
|
Daily perceived pushing target -> agent
|
0.95
|
0.80
|
1.14
|
1.000
|
11595.76
|
9453.42
|
|
Day
|
0.91
|
0.58
|
1.42
|
1.001
|
8994.22
|
9509.62
|
|
Daily weartime
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Daily perceived support target -> target
|
0.91*
|
0.84
|
0.99
|
1.000
|
12435.39
|
9090.73
|
|
Daily perceived support target -> agent
|
0.98
|
0.90
|
1.07
|
1.000
|
12356.19
|
8894.80
|
|
Is a weekend
|
1.03
|
0.84
|
1.27
|
1.001
|
14664.51
|
8949.57
|
|
JITAI received
|
1.02
|
0.78
|
1.35
|
1.000
|
12846.20
|
8919.53
|
|
Days post skilled support intervention
|
1.11
|
0.78
|
1.55
|
1.000
|
7409.37
|
7956.50
|
|
Between-Person Effects
|
|
Mean perceived persuasion target -> target
|
1.07
|
0.63
|
1.85
|
1.001
|
5272.04
|
7819.99
|
|
Mean Perceived persuasion target -> agent
|
1.12
|
0.65
|
1.94
|
1.001
|
5349.01
|
7371.32
|
|
Mean Perceived pressure target -> target
|
1.50
|
0.76
|
3.00
|
1.000
|
6895.54
|
8349.79
|
|
Mean Perceived pressure target -> agent
|
0.68
|
0.31
|
1.46
|
1.000
|
5516.07
|
7979.83
|
|
Mean Perceived pushing target -> target
|
0.47
|
0.19
|
1.18
|
1.001
|
5933.99
|
7858.00
|
|
Mean Perceived pushing target -> agent
|
0.63
|
0.28
|
1.43
|
1.001
|
7587.94
|
8442.95
|
|
Mean weartime
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Difference study group 2
|
0.80
|
0.55
|
1.18
|
1.000
|
4638.88
|
6948.83
|
|
Difference study group 3
|
0.71
|
0.49
|
1.04
|
1.000
|
4903.37
|
7219.70
|
|
Random Effects
|
|
sd(Intercept)
|
0.68
|
0.50
|
0.91
|
1.00
|
3179.49
|
5538.69
|
|
sd(Daily perceived persuasion target -> target)
|
0.21
|
0.06
|
0.37
|
1.00
|
2371.80
|
1602.37
|
|
sd(Daily perceived persuasion target -> agent)
|
0.18
|
0.04
|
0.33
|
1.00
|
3707.08
|
2508.60
|
|
sd(Daily perceived pressure target -> target)
|
0.16
|
0.01
|
0.48
|
1.00
|
6671.37
|
5767.59
|
|
sd(Daily perceived pressure target -> agent)
|
0.15
|
0.01
|
0.45
|
1.00
|
7438.06
|
5612.28
|
|
sd(Daily perceived pushing target -> target)
|
0.25
|
0.02
|
0.53
|
1.00
|
2524.09
|
2545.36
|
|
sd(Daily perceived pushing target -> agent)
|
0.15
|
0.01
|
0.37
|
1.00
|
4813.06
|
4298.98
|
|
Additional Parameters
|
|
ar[1]
|
0.02
|
-0.94
|
0.94
|
1.00
|
13102.70
|
8324.90
|
|
nu
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
shape
|
0.14
|
0.13
|
0.14
|
1.00
|
14533.48
|
8192.86
|
|
sderr
|
0.05
|
0.00
|
0.13
|
1.00
|
6664.51
|
5127.68
|
|
sigma
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
Device Based MVPA
range(df_double$pa_obj, na.rm = T)
## [1] 5.75 971.25
hist(df_double$pa_obj, breaks = 50)

df_double$pa_obj_log <- log(df_double$pa_obj)
hist(df_double$pa_obj_log, breaks = 50)

We tried negative binomial here as well for consistency, but the
model did not converge. Poisson also did not work. As we have no zeros
in this distribution, we log transform.
formula <- bf(
pa_obj_log ~
persuasion_self_cw + persuasion_partner_cw +
pressure_self_cw + pressure_partner_cw +
pushing_self_cw + pushing_partner_cw +
#barriers_self_cw +
support_self_cw + support_partner_cw +
#comf_self_cw + reas_self_cw +
isWeekend +
got_JITAI_self + skilled_support +
persuasion_self_cb + persuasion_partner_cb +
pressure_self_cb + pressure_partner_cb +
pushing_self_cb + pushing_partner_cb +
studyGroup +
day + weartime_self_cw + weartime_self_cb +
# Random effects
(persuasion_self_cw + persuasion_partner_cw +
pressure_self_cw + pressure_partner_cw +
pushing_self_cw + pushing_partner_cw | coupleID),
autocor = ~ ar(time = day, gr = coupleID:userID, p = 1)
)
prior1 <- c(
brms::set_prior("normal(0, 2.5)", class = "b"),
brms::set_prior("normal(0, 50)", class = "Intercept", lb = 0),
brms::set_prior("normal(0, 10)", class = "sd", group = "coupleID", lb = 0),
brms::set_prior("cauchy(0, 5)", class = "ar", lb = -1, ub = 1),
brms::set_prior("cauchy(0, 10)", class = "sigma", lb = 0)
)
#df_minimal <- df_double[, c("userID", all.vars(as.formula(formula)))]
pa_obj_log <- my_brm(
mi = use_mi,
imputed_data = implist,
formula = formula,
prior = prior1,
data = df_double,
family = gaussian(),
#control = list(adapt_delta = 0.99),
iter = 5000,
warmup = 2000,
chains = 4,
cores = 4,
seed = 7777,
file = file.path("models_cache_brms", "all_covariates_pa_obj_log")
)
# plotting with the first imputed dataset.
pp_check(pa_obj_log, type='hist')
## Using 10 posterior draws for ppc type 'hist' by default.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

## Using 10 posterior draws for ppc type 'dens_overlay' by default.

##
## Computed from 12000 by 3333 log-likelihood matrix.
##
## Estimate SE
## elpd_loo -2804.0 55.8
## p_loo 105.6 4.8
## looic 5607.9 111.6
## ------
## MCSE of elpd_loo is 0.1.
## MCSE and ESS estimates assume MCMC draws (r_eff in [0.4, 2.3]).
##
## All Pareto k estimates are good (k < 0.7).
## See help('pareto-k-diagnostic') for details.
plot(pa_obj_log, ask = FALSE)











summarize_brms(
pa_obj_log,
model_rows_fixed = model_rows_fixed,
model_rows_random = model_rows_random,
model_rownames_fixed = model_rownames_fixed,
model_rownames_random = model_rownames_random,
exponentiate = T) %>%
print_df(rows_to_pack = rows_to_pack)
|
|
exp(Est.)
|
l-95% CI
|
u-95% CI
|
Rhat
|
Bulk_ESS
|
Tail_ESS
|
|
Intercept
|
113.71*
|
100.07
|
129.35
|
1.001
|
4253.31
|
6585.20
|
|
Within-Person Effects
|
|
Daily perceived persuasion target -> target
|
0.99
|
0.97
|
1.02
|
1.000
|
22937.49
|
9284.23
|
|
Daily perceived persuasion target -> agent
|
1.02
|
1.00
|
1.04
|
1.000
|
25015.90
|
9446.88
|
|
Daily perceived pressure target -> target
|
1.00
|
0.95
|
1.05
|
1.001
|
26142.51
|
8763.25
|
|
Daily perceived pressure target -> agent
|
0.96
|
0.91
|
1.02
|
1.000
|
24684.48
|
7569.35
|
|
Daily perceived pushing target -> target
|
1.03*
|
1.00
|
1.07
|
1.001
|
28242.93
|
9251.76
|
|
Daily perceived pushing target -> agent
|
0.98
|
0.95
|
1.02
|
1.001
|
23880.11
|
8564.22
|
|
Day
|
0.88*
|
0.79
|
1.00
|
1.000
|
18813.42
|
10030.83
|
|
Daily weartime
|
1.00
|
1.00
|
1.00
|
1.000
|
12492.20
|
8193.11
|
|
Daily perceived support target -> target
|
0.99
|
0.97
|
1.00
|
1.001
|
23716.02
|
9023.86
|
|
Daily perceived support target -> agent
|
1.00
|
0.98
|
1.01
|
1.000
|
24310.05
|
9653.73
|
|
Is a weekend
|
0.99
|
0.95
|
1.04
|
1.000
|
27142.07
|
8077.70
|
|
JITAI received
|
0.96
|
0.91
|
1.02
|
1.000
|
26334.05
|
9199.70
|
|
Days post skilled support intervention
|
1.10*
|
1.01
|
1.21
|
1.001
|
18258.56
|
9637.22
|
|
Between-Person Effects
|
|
Mean perceived persuasion target -> target
|
0.91
|
0.77
|
1.08
|
1.000
|
9195.93
|
9765.30
|
|
Mean Perceived persuasion target -> agent
|
1.09
|
0.91
|
1.30
|
1.000
|
8590.77
|
9517.42
|
|
Mean Perceived pressure target -> target
|
1.09
|
0.86
|
1.38
|
1.001
|
15066.71
|
9845.10
|
|
Mean Perceived pressure target -> agent
|
0.78*
|
0.63
|
0.97
|
1.000
|
12349.20
|
9473.69
|
|
Mean Perceived pushing target -> target
|
0.99
|
0.74
|
1.32
|
1.000
|
11324.00
|
9349.74
|
|
Mean Perceived pushing target -> agent
|
1.22
|
0.95
|
1.55
|
1.000
|
13259.91
|
9433.64
|
|
Mean weartime
|
1.00*
|
1.00
|
1.00
|
1.000
|
12685.83
|
10719.60
|
|
Difference study group 2
|
0.97
|
0.87
|
1.09
|
1.001
|
8224.59
|
9554.40
|
|
Difference study group 3
|
1.12
|
0.99
|
1.26
|
1.000
|
8605.56
|
9657.17
|
|
Random Effects
|
|
sd(Intercept)
|
0.27
|
0.20
|
0.35
|
1.00
|
4178.82
|
6678.95
|
|
sd(Daily perceived persuasion target -> target)
|
0.06
|
0.03
|
0.09
|
1.00
|
8618.18
|
8518.55
|
|
sd(Daily perceived persuasion target -> agent)
|
0.05
|
0.03
|
0.08
|
1.00
|
8655.75
|
7996.58
|
|
sd(Daily perceived pressure target -> target)
|
0.06
|
0.00
|
0.15
|
1.00
|
5447.68
|
6413.91
|
|
sd(Daily perceived pressure target -> agent)
|
0.04
|
0.00
|
0.10
|
1.00
|
8636.38
|
7330.29
|
|
sd(Daily perceived pushing target -> target)
|
0.08
|
0.01
|
0.15
|
1.00
|
3445.20
|
3683.34
|
|
sd(Daily perceived pushing target -> agent)
|
0.03
|
0.00
|
0.09
|
1.00
|
5550.38
|
6986.72
|
|
Additional Parameters
|
|
ar[1]
|
0.28
|
0.24
|
0.31
|
1.00
|
25198.31
|
8281.84
|
|
nu
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
shape
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
sderr
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
sigma
|
0.55
|
0.54
|
0.57
|
1.00
|
22864.76
|
8154.94
|
Affect
range(df_double$aff, na.rm = T)
## [1] 1 6
hist(df_double$aff, breaks = 15)

formula <- bf(
aff ~
persuasion_self_cw + persuasion_partner_cw +
pressure_self_cw + pressure_partner_cw +
pushing_self_cw + pushing_partner_cw +
#barriers_self_cw +
support_self_cw + support_partner_cw +
#comf_self_cw + reas_self_cw +
isWeekend +
got_JITAI_self + skilled_support +
persuasion_self_cb + persuasion_partner_cb +
pressure_self_cb + pressure_partner_cb +
pushing_self_cb + pushing_partner_cb +
studyGroup +
day +
# Random effects
(persuasion_self_cw + persuasion_partner_cw +
pressure_self_cw + pressure_partner_cw +
pushing_self_cw + pushing_partner_cw | coupleID),
autocor = ~ ar(time = day, gr = coupleID:userID, p = 1)
)
prior1 <- c(
brms::set_prior("normal(0, 5)", class = "b"),
brms::set_prior("normal(0, 20)", class = "Intercept", lb=0, ub=6), # range of the outcome scale
brms::set_prior("normal(0, 2)", class = "sd", group = "coupleID", lb = 0),
brms::set_prior("cauchy(0, 5)", class = "ar", lb = -1, ub = 1),
brms::set_prior("cauchy(0, 10)", class = "sigma", lb = 0)
)
df_minimal <- df_double[, c("userID", all.vars(as.formula(formula)))]
mood <- my_brm(
mi = use_mi,
imputed_data = implist,
formula = formula,
prior = prior1,
data = df_double,
family = gaussian(),
#control = list(adapt_delta = 0.95, max_treedepth = 15),
iter = 5000,
warmup = 2000,
chains = 4,
cores = 4,
seed = 7777,
file = file.path("models_cache_brms", "all_covariates_mood")
)
pp_check(mood, type='hist')
## Using 10 posterior draws for ppc type 'hist' by default.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

## Using 10 posterior draws for ppc type 'dens_overlay' by default.

##
## Computed from 12000 by 3732 log-likelihood matrix.
##
## Estimate SE
## elpd_loo -4816.2 64.0
## p_loo 99.6 4.6
## looic 9632.5 128.0
## ------
## MCSE of elpd_loo is 0.1.
## MCSE and ESS estimates assume MCMC draws (r_eff in [0.4, 2.1]).
##
## All Pareto k estimates are good (k < 0.7).
## See help('pareto-k-diagnostic') for details.











summarize_brms(
mood,
model_rows_fixed = model_rows_fixed,
model_rows_random = model_rows_random,
model_rownames_fixed = model_rownames_fixed,
model_rownames_random = model_rownames_random,
exponentiate = F) %>%
print_df(rows_to_pack = rows_to_pack)
|
|
b
|
l-95% CI
|
u-95% CI
|
Rhat
|
Bulk_ESS
|
Tail_ESS
|
|
Intercept
|
5.05*
|
4.78
|
5.31
|
1.001
|
1787.92
|
4236.13
|
|
Within-Person Effects
|
|
Daily perceived persuasion target -> target
|
0.02
|
-0.01
|
0.05
|
1.000
|
15244.35
|
9265.67
|
|
Daily perceived persuasion target -> agent
|
-0.02
|
-0.05
|
0.01
|
1.000
|
15536.54
|
9648.67
|
|
Daily perceived pressure target -> target
|
-0.02
|
-0.09
|
0.06
|
1.000
|
18693.97
|
8846.55
|
|
Daily perceived pressure target -> agent
|
0.04
|
-0.04
|
0.11
|
1.001
|
17922.44
|
8101.11
|
|
Daily perceived pushing target -> target
|
-0.03
|
-0.08
|
0.01
|
1.001
|
17850.56
|
8603.18
|
|
Daily perceived pushing target -> agent
|
-0.02
|
-0.06
|
0.03
|
1.000
|
18206.81
|
9527.37
|
|
Day
|
-0.06
|
-0.27
|
0.14
|
1.000
|
10198.11
|
9336.07
|
|
Daily weartime
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Daily perceived support target -> target
|
-0.01
|
-0.04
|
0.01
|
1.000
|
15589.55
|
9362.03
|
|
Daily perceived support target -> agent
|
0.00
|
-0.02
|
0.03
|
1.000
|
15979.40
|
9150.54
|
|
Is a weekend
|
0.06
|
0.00
|
0.13
|
1.000
|
18191.56
|
8468.56
|
|
JITAI received
|
0.03
|
-0.05
|
0.10
|
1.001
|
17601.05
|
9126.63
|
|
Days post skilled support intervention
|
-0.09
|
-0.24
|
0.07
|
1.000
|
10107.63
|
9960.36
|
|
Between-Person Effects
|
|
Mean perceived persuasion target -> target
|
0.24
|
-0.08
|
0.56
|
1.000
|
5123.35
|
7587.45
|
|
Mean Perceived persuasion target -> agent
|
0.05
|
-0.26
|
0.36
|
1.000
|
5000.31
|
7650.46
|
|
Mean Perceived pressure target -> target
|
0.13
|
-0.24
|
0.49
|
1.000
|
9289.56
|
9066.74
|
|
Mean Perceived pressure target -> agent
|
-0.18
|
-0.56
|
0.20
|
1.000
|
6938.15
|
8407.71
|
|
Mean Perceived pushing target -> target
|
-0.40
|
-0.93
|
0.13
|
1.000
|
5974.49
|
8212.38
|
|
Mean Perceived pushing target -> agent
|
-0.07
|
-0.52
|
0.39
|
1.000
|
6773.04
|
7868.65
|
|
Mean weartime
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Difference study group 2
|
-0.25*
|
-0.47
|
-0.02
|
1.001
|
5251.93
|
7599.96
|
|
Difference study group 3
|
-0.01
|
-0.22
|
0.20
|
1.000
|
5763.20
|
7920.22
|
|
Random Effects
|
|
sd(Intercept)
|
0.63
|
0.49
|
0.81
|
1.00
|
2475.39
|
4700.39
|
|
sd(Daily perceived persuasion target -> target)
|
0.03
|
0.00
|
0.07
|
1.00
|
5102.77
|
5489.09
|
|
sd(Daily perceived persuasion target -> agent)
|
0.05
|
0.01
|
0.11
|
1.00
|
2646.12
|
3296.59
|
|
sd(Daily perceived pressure target -> target)
|
0.09
|
0.00
|
0.26
|
1.00
|
3476.20
|
4494.78
|
|
sd(Daily perceived pressure target -> agent)
|
0.14
|
0.01
|
0.32
|
1.00
|
3263.89
|
3747.58
|
|
sd(Daily perceived pushing target -> target)
|
0.09
|
0.02
|
0.16
|
1.00
|
4357.66
|
3246.71
|
|
sd(Daily perceived pushing target -> agent)
|
0.08
|
0.01
|
0.17
|
1.00
|
4128.00
|
3958.70
|
|
Additional Parameters
|
|
ar[1]
|
0.45
|
0.42
|
0.48
|
1.00
|
15283.87
|
8183.53
|
|
nu
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
shape
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
sderr
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
sigma
|
0.87
|
0.85
|
0.89
|
1.00
|
16411.51
|
8931.96
|
reactance
range(df_double$reactance, na.rm = T)
## [1] 0 5
hist(df_double$reactance, breaks = 6)

formula <- bf(
reactance ~
persuasion_self_cw + persuasion_partner_cw +
pressure_self_cw + pressure_partner_cw +
pushing_self_cw + pushing_partner_cw +
#barriers_self_cw +
support_self_cw + support_partner_cw +
#comf_self_cw + reas_self_cw +
isWeekend +
got_JITAI_self + skilled_support +
persuasion_self_cb + persuasion_partner_cb +
pressure_self_cb + pressure_partner_cb +
pushing_self_cb + pushing_partner_cb +
studyGroup +
day +
# Random effects
(persuasion_self_cw + persuasion_partner_cw +
pressure_self_cw + pressure_partner_cw +
pushing_self_cw + pushing_partner_cw | coupleID),
autocor = ~ ar(time = day, gr = coupleID:userID, p = 1)
)
prior1 <- c(
brms::set_prior("normal(0, 5)", class = "b"),
brms::set_prior("normal(0, 20)", class = "Intercept", lb=0, ub=5), # range of the outcome scale
brms::set_prior("normal(0, 2)", class = "sd", group = "coupleID", lb = 0),
brms::set_prior("cauchy(0, 5)", class = "ar", lb = -1, ub = 1),
brms::set_prior("cauchy(0, 10)", class = "sigma", lb = 0)
)
df_minimal <- df_double[, c("userID", all.vars(as.formula(formula)))]
reactance <- my_brm(
mi = use_mi,
imputed_data = implist,
formula = formula,
prior = prior1,
data = df_double,
family = gaussian(),
#control = list(adapt_delta = 0.95, max_treedepth = 15),
iter = 5000,
warmup = 2000,
chains = 4,
cores = 4,
seed = 7777,
file = file.path("models_cache_brms", "all_covariates_reactance")
)
pp_check(reactance, type='hist')
## Using 10 posterior draws for ppc type 'hist' by default.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

## Using 10 posterior draws for ppc type 'dens_overlay' by default.

##
## Computed from 12000 by 755 log-likelihood matrix.
##
## Estimate SE
## elpd_loo -1078.3 33.6
## p_loo 91.4 8.3
## looic 2156.5 67.1
## ------
## MCSE of elpd_loo is NA.
## MCSE and ESS estimates assume MCMC draws (r_eff in [0.5, 1.9]).
##
## Pareto k diagnostic values:
## Count Pct. Min. ESS
## (-Inf, 0.7] (good) 746 98.8% 413
## (0.7, 1] (bad) 9 1.2% <NA>
## (1, Inf) (very bad) 0 0.0% <NA>
## See help('pareto-k-diagnostic') for details.
plot(reactance, ask = FALSE)











## Family: gaussian
## Links: mu = identity; sigma = identity
## Formula: reactance ~ persuasion_self_cw + persuasion_partner_cw + pressure_self_cw + pressure_partner_cw + pushing_self_cw + pushing_partner_cw + support_self_cw + support_partner_cw + isWeekend + got_JITAI_self + skilled_support + persuasion_self_cb + persuasion_partner_cb + pressure_self_cb + pressure_partner_cb + pushing_self_cb + pushing_partner_cb + studyGroup + day + (persuasion_self_cw + persuasion_partner_cw + pressure_self_cw + pressure_partner_cw + pushing_self_cw + pushing_partner_cw | coupleID)
## autocor ~ ar(time = day, gr = coupleID:userID, p = 1)
## Data: data (Number of observations: 755)
## Draws: 4 chains, each with iter = 5000; warmup = 2000; thin = 1;
## total post-warmup draws = 12000
##
## Correlation Structures:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## ar[1] 0.01 0.04 -0.07 0.10 1.00 16289 10028
##
## Multilevel Hyperparameters:
## ~coupleID (Number of levels: 38)
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept) 0.58 0.09 0.43 0.77 1.00 6019 8283
## sd(persuasion_self_cw) 0.06 0.04 0.00 0.15 1.00 3677 6662
## sd(persuasion_partner_cw) 0.04 0.03 0.00 0.11 1.00 8313 7809
## sd(pressure_self_cw) 0.44 0.10 0.28 0.67 1.00 9028 9596
## sd(pressure_partner_cw) 0.23 0.15 0.02 0.59 1.00 3616 5689
## sd(pushing_self_cw) 0.08 0.06 0.00 0.22 1.00 3344 6851
## sd(pushing_partner_cw) 0.04 0.04 0.00 0.14 1.00 9185 7906
## cor(Intercept,persuasion_self_cw) -0.20 0.31 -0.73 0.48 1.00 12183 8672
## cor(Intercept,persuasion_partner_cw) 0.05 0.33 -0.59 0.67 1.00 24220 9239
## cor(persuasion_self_cw,persuasion_partner_cw) -0.01 0.36 -0.68 0.67 1.00 16798 9659
## cor(Intercept,pressure_self_cw) 0.30 0.20 -0.13 0.67 1.00 8304 8637
## cor(persuasion_self_cw,pressure_self_cw) -0.18 0.33 -0.74 0.50 1.00 4111 7291
## cor(persuasion_partner_cw,pressure_self_cw) 0.00 0.35 -0.66 0.66 1.00 4220 7952
## cor(Intercept,pressure_partner_cw) 0.21 0.25 -0.29 0.69 1.00 12330 9093
## cor(persuasion_self_cw,pressure_partner_cw) 0.01 0.35 -0.65 0.66 1.00 10377 9097
## cor(persuasion_partner_cw,pressure_partner_cw) -0.02 0.35 -0.67 0.66 1.00 9709 9516
## cor(pressure_self_cw,pressure_partner_cw) 0.03 0.31 -0.56 0.63 1.00 14224 9004
## cor(Intercept,pushing_self_cw) -0.01 0.27 -0.54 0.53 1.00 14982 8924
## cor(persuasion_self_cw,pushing_self_cw) -0.02 0.35 -0.68 0.66 1.00 10657 9588
## cor(persuasion_partner_cw,pushing_self_cw) 0.03 0.36 -0.66 0.68 1.00 9290 9615
## cor(pressure_self_cw,pushing_self_cw) 0.06 0.33 -0.60 0.66 1.00 13253 10342
## cor(pressure_partner_cw,pushing_self_cw) 0.02 0.36 -0.66 0.69 1.00 8850 9565
## cor(Intercept,pushing_partner_cw) 0.03 0.31 -0.58 0.62 1.00 19738 9074
## cor(persuasion_self_cw,pushing_partner_cw) 0.03 0.35 -0.65 0.70 1.00 18685 8661
## cor(persuasion_partner_cw,pushing_partner_cw) -0.03 0.36 -0.69 0.65 1.00 13713 9210
## cor(pressure_self_cw,pushing_partner_cw) -0.06 0.35 -0.70 0.62 1.00 17304 10095
## cor(pressure_partner_cw,pushing_partner_cw) 0.02 0.36 -0.66 0.69 1.00 11850 9697
## cor(pushing_self_cw,pushing_partner_cw) 0.02 0.36 -0.65 0.68 1.00 10836 10468
##
## Regression Coefficients:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## Intercept 0.58 0.16 0.26 0.90 1.00 7744 8783
## persuasion_self_cw -0.01 0.03 -0.06 0.05 1.00 20425 9615
## persuasion_partner_cw 0.00 0.03 -0.07 0.07 1.00 21357 9939
## pressure_self_cw -0.03 0.05 -0.12 0.07 1.00 24948 9144
## pressure_partner_cw 0.08 0.06 -0.05 0.20 1.00 24546 9646
## pushing_self_cw -0.03 0.03 -0.09 0.03 1.00 25660 9310
## pushing_partner_cw 0.01 0.04 -0.07 0.08 1.00 26664 10055
## support_self_cw 0.03 0.03 -0.02 0.09 1.00 21817 9584
## support_partner_cw -0.01 0.03 -0.06 0.04 1.00 20855 10051
## isWeekendWeekend -0.15 0.08 -0.31 0.01 1.00 25252 9397
## got_JITAI_selfJITAIreceived 0.06 0.11 -0.15 0.27 1.00 23904 10276
## skilled_supportDaysafterIntervention -0.01 0.14 -0.28 0.26 1.00 14510 9639
## persuasion_self_cb -0.16 0.20 -0.54 0.23 1.00 10767 9327
## persuasion_partner_cb 0.12 0.20 -0.27 0.52 1.00 12748 9974
## pressure_self_cb 0.23 0.22 -0.20 0.67 1.00 13834 9760
## pressure_partner_cb -0.11 0.24 -0.58 0.37 1.00 12394 9199
## pushing_self_cb -0.16 0.31 -0.78 0.44 1.00 11670 9545
## pushing_partner_cb 0.03 0.31 -0.57 0.63 1.00 13795 9840
## studyGroupFirst3weeksinterventions -0.02 0.13 -0.27 0.23 1.00 16460 8698
## studyGrouplast3weeksinterventions 0.18 0.15 -0.11 0.46 1.00 12962 9079
## day -0.16 0.20 -0.56 0.22 1.00 15589 9433
##
## Further Distributional Parameters:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sigma 0.94 0.03 0.89 1.00 1.00 11717 9009
##
## Draws were sampled using sample(hmc). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
summarize_brms(
reactance,
model_rows_fixed = model_rows_fixed,
model_rows_random = model_rows_random,
model_rownames_fixed = model_rownames_fixed,
model_rownames_random = model_rownames_random,
exponentiate = F) %>%
print_df(rows_to_pack = rows_to_pack)
|
|
b
|
l-95% CI
|
u-95% CI
|
Rhat
|
Bulk_ESS
|
Tail_ESS
|
|
Intercept
|
0.58*
|
0.26
|
0.90
|
1.000
|
7744.35
|
8782.74
|
|
Within-Person Effects
|
|
Daily perceived persuasion target -> target
|
-0.01
|
-0.06
|
0.05
|
1.001
|
20424.84
|
9614.63
|
|
Daily perceived persuasion target -> agent
|
0.00
|
-0.07
|
0.07
|
1.000
|
21357.22
|
9939.32
|
|
Daily perceived pressure target -> target
|
-0.03
|
-0.12
|
0.07
|
1.000
|
24947.66
|
9143.64
|
|
Daily perceived pressure target -> agent
|
0.08
|
-0.05
|
0.20
|
1.000
|
24545.74
|
9645.55
|
|
Daily perceived pushing target -> target
|
-0.03
|
-0.09
|
0.03
|
1.000
|
25660.20
|
9309.69
|
|
Daily perceived pushing target -> agent
|
0.01
|
-0.07
|
0.08
|
1.000
|
26663.88
|
10055.16
|
|
Day
|
-0.16
|
-0.56
|
0.22
|
1.000
|
15588.50
|
9432.62
|
|
Daily weartime
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Daily perceived support target -> target
|
0.03
|
-0.02
|
0.09
|
1.001
|
21816.79
|
9583.63
|
|
Daily perceived support target -> agent
|
-0.01
|
-0.06
|
0.04
|
1.000
|
20854.54
|
10051.05
|
|
Is a weekend
|
-0.15
|
-0.31
|
0.01
|
1.000
|
25252.35
|
9397.32
|
|
JITAI received
|
0.06
|
-0.15
|
0.27
|
1.000
|
23904.19
|
10275.81
|
|
Days post skilled support intervention
|
-0.01
|
-0.28
|
0.26
|
1.000
|
14510.00
|
9638.81
|
|
Between-Person Effects
|
|
Mean perceived persuasion target -> target
|
-0.16
|
-0.54
|
0.23
|
1.000
|
10767.38
|
9327.50
|
|
Mean Perceived persuasion target -> agent
|
0.12
|
-0.27
|
0.52
|
1.000
|
12748.11
|
9974.01
|
|
Mean Perceived pressure target -> target
|
0.23
|
-0.20
|
0.67
|
1.000
|
13834.11
|
9760.14
|
|
Mean Perceived pressure target -> agent
|
-0.11
|
-0.58
|
0.37
|
1.001
|
12393.77
|
9199.46
|
|
Mean Perceived pushing target -> target
|
-0.16
|
-0.78
|
0.44
|
1.001
|
11669.89
|
9545.08
|
|
Mean Perceived pushing target -> agent
|
0.03
|
-0.57
|
0.63
|
1.000
|
13795.32
|
9840.39
|
|
Mean weartime
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Difference study group 2
|
-0.02
|
-0.27
|
0.23
|
1.000
|
16459.57
|
8698.24
|
|
Difference study group 3
|
0.18
|
-0.11
|
0.46
|
1.000
|
12962.30
|
9079.50
|
|
Random Effects
|
|
sd(Intercept)
|
0.58
|
0.43
|
0.77
|
1.00
|
6018.86
|
8283.19
|
|
sd(Daily perceived persuasion target -> target)
|
0.06
|
0.00
|
0.15
|
1.00
|
3677.09
|
6661.98
|
|
sd(Daily perceived persuasion target -> agent)
|
0.04
|
0.00
|
0.11
|
1.00
|
8313.37
|
7809.48
|
|
sd(Daily perceived pressure target -> target)
|
0.44
|
0.28
|
0.67
|
1.00
|
9027.83
|
9595.62
|
|
sd(Daily perceived pressure target -> agent)
|
0.23
|
0.02
|
0.59
|
1.00
|
3615.52
|
5689.37
|
|
sd(Daily perceived pushing target -> target)
|
0.08
|
0.00
|
0.22
|
1.00
|
3343.60
|
6851.45
|
|
sd(Daily perceived pushing target -> agent)
|
0.04
|
0.00
|
0.14
|
1.00
|
9185.20
|
7905.97
|
|
Additional Parameters
|
|
ar[1]
|
0.01
|
-0.07
|
0.10
|
1.00
|
16289.25
|
10027.77
|
|
nu
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
shape
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
sderr
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
sigma
|
0.94
|
0.89
|
1.00
|
1.00
|
11716.99
|
9009.46
|
Binary Version
introduce_binary_reactance <- function(data) {
data$is_reactance <- factor(data$reactance > 0, levels = c(FALSE, TRUE), labels = c(0, 1))
return(data)
}
df_double <- introduce_binary_reactance(df_double)
if (use_mi) {
for (i in seq_along(implist)) {
implist[[i]] <- introduce_binary_reactance(implist[[i]])
}
}
formula <- bf(
is_reactance ~
persuasion_self_cw + persuasion_partner_cw +
pressure_self_cw + pressure_partner_cw +
pushing_self_cw + pushing_partner_cw +
#barriers_self_cw +
support_self_cw + support_partner_cw +
#comf_self_cw + reas_self_cw +
isWeekend +
got_JITAI_self + skilled_support +
persuasion_self_cb + persuasion_partner_cb +
pressure_self_cb + pressure_partner_cb +
pushing_self_cb + pushing_partner_cb +
studyGroup +
day +
# Random effects
(persuasion_self_cw + persuasion_partner_cw +
pressure_self_cw + pressure_partner_cw +
pushing_self_cw + pushing_partner_cw | coupleID),
autocor = ~ ar(time = day, gr = coupleID:userID, p = 1)
)
prior1 <- c(
brms::set_prior("normal(0, 5)", class = "b"),
brms::set_prior("normal(0, 20)", class = "Intercept", lb=0, ub=5), # range of the outcome scale
brms::set_prior("normal(0, 2)", class = "sd", group = "coupleID", lb = 0),
brms::set_prior("cauchy(0, 5)", class = "ar", lb = -1, ub = 1)
#brms::set_prior("cauchy(0, 10)", class = "sigma", lb = 0)
)
df_minimal <- df_double[, c("userID", all.vars(as.formula(formula)))]
is_reactance <- my_brm(
mi = use_mi,
imputed_data = implist,
formula = formula,
prior = prior1,
data = df_double,
family = bernoulli(),
#control = list(adapt_delta = 0.95, max_treedepth = 15),
iter = 5000,
warmup = 2000,
chains = 4,
cores = 4,
seed = 7777,
file = file.path("models_cache_brms", "all_covariates_is_reactance")
)
pp_check(is_reactance, type='hist')
## Using 10 posterior draws for ppc type 'hist' by default.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

## Using 10 posterior draws for ppc type 'dens_overlay' by default.

##
## Computed from 12000 by 755 log-likelihood matrix.
##
## Estimate SE
## elpd_loo -617.7 23.9
## p_loo 570.0 22.7
## looic 1235.5 47.8
## ------
## MCSE of elpd_loo is NA.
## MCSE and ESS estimates assume MCMC draws (r_eff in [0.8, 1.2]).
##
## Pareto k diagnostic values:
## Count Pct. Min. ESS
## (-Inf, 0.7] (good) 2 0.3% 504
## (0.7, 1] (bad) 148 19.6% <NA>
## (1, Inf) (very bad) 605 80.1% <NA>
## See help('pareto-k-diagnostic') for details.
plot(is_reactance, ask = FALSE)











summarize_brms(
is_reactance,
model_rows_fixed = model_rows_fixed,
model_rows_random = model_rows_random,
model_rownames_fixed = model_rownames_fixed,
model_rownames_random = model_rownames_random,
exponentiate = T) %>%
print_df(rows_to_pack = rows_to_pack)
|
|
OR
|
l-95% CI
|
u-95% CI
|
Rhat
|
Bulk_ESS
|
Tail_ESS
|
|
Intercept
|
8.00
|
0.23
|
379.95
|
1.000
|
8994.85
|
9710.75
|
|
Within-Person Effects
|
|
Daily perceived persuasion target -> target
|
0.79
|
0.31
|
1.90
|
1.000
|
8128.27
|
8651.69
|
|
Daily perceived persuasion target -> agent
|
0.89
|
0.29
|
2.70
|
1.000
|
7901.12
|
8726.10
|
|
Daily perceived pressure target -> target
|
0.98
|
0.21
|
4.87
|
1.001
|
9163.07
|
8832.56
|
|
Daily perceived pressure target -> agent
|
3.13
|
0.45
|
27.49
|
1.001
|
8551.09
|
8335.61
|
|
Daily perceived pushing target -> target
|
0.42
|
0.13
|
1.15
|
1.001
|
8507.10
|
8661.84
|
|
Daily perceived pushing target -> agent
|
1.10
|
0.31
|
3.90
|
1.000
|
8729.41
|
8845.38
|
|
Day
|
0.50
|
0.00
|
91.98
|
1.000
|
9540.03
|
8258.20
|
|
Daily weartime
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Daily perceived support target -> target
|
1.50
|
0.65
|
3.75
|
1.000
|
7598.49
|
8525.59
|
|
Daily perceived support target -> agent
|
0.76
|
0.29
|
1.85
|
1.000
|
8719.41
|
8653.74
|
|
Is a weekend
|
0.10
|
0.01
|
1.25
|
1.000
|
7946.33
|
8055.38
|
|
JITAI received
|
1.48
|
0.05
|
47.00
|
1.000
|
8790.24
|
8814.15
|
|
Days post skilled support intervention
|
0.26
|
0.00
|
11.29
|
1.000
|
8857.63
|
9130.37
|
|
Between-Person Effects
|
|
Mean perceived persuasion target -> target
|
0.21
|
0.00
|
28.89
|
1.001
|
9150.33
|
8719.55
|
|
Mean Perceived persuasion target -> agent
|
7.60
|
0.08
|
854.29
|
1.000
|
10814.47
|
9824.59
|
|
Mean Perceived pressure target -> target
|
5.42
|
0.03
|
1043.94
|
1.000
|
10006.02
|
9361.64
|
|
Mean Perceived pressure target -> agent
|
0.54
|
0.00
|
130.98
|
1.000
|
10350.07
|
9183.34
|
|
Mean Perceived pushing target -> target
|
0.50
|
0.00
|
538.20
|
1.000
|
11815.93
|
9995.38
|
|
Mean Perceived pushing target -> agent
|
0.13
|
0.00
|
104.50
|
1.000
|
11437.32
|
9098.73
|
|
Mean weartime
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Difference study group 2
|
0.70
|
0.02
|
31.46
|
1.000
|
9026.36
|
8537.86
|
|
Difference study group 3
|
9.04
|
0.16
|
593.72
|
1.000
|
9606.96
|
9289.68
|
|
Random Effects
|
|
sd(Intercept)
|
7.48
|
5.31
|
10.00
|
1.00
|
8837.71
|
8787.98
|
|
sd(Daily perceived persuasion target -> target)
|
1.75
|
0.32
|
3.39
|
1.00
|
2637.59
|
2580.53
|
|
sd(Daily perceived persuasion target -> agent)
|
1.45
|
0.11
|
3.24
|
1.00
|
2825.34
|
4515.56
|
|
sd(Daily perceived pressure target -> target)
|
3.74
|
1.63
|
6.14
|
1.00
|
4573.95
|
3791.33
|
|
sd(Daily perceived pressure target -> agent)
|
1.28
|
0.05
|
3.71
|
1.00
|
7738.49
|
8276.93
|
|
sd(Daily perceived pushing target -> target)
|
0.93
|
0.03
|
2.55
|
1.00
|
3680.55
|
7380.74
|
|
sd(Daily perceived pushing target -> agent)
|
0.96
|
0.04
|
2.70
|
1.00
|
6687.99
|
7755.31
|
|
Additional Parameters
|
|
ar[1]
|
0.14
|
-0.06
|
0.34
|
1.00
|
2667.32
|
4936.84
|
|
nu
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
shape
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
sderr
|
9.86
|
6.33
|
14.34
|
1.00
|
4282.36
|
6561.65
|
|
sigma
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
Report All Models
if (report_ordinal) {
model_rows_random_final <- model_rows_random_ordinal
model_rows_fixed_final <- model_rows_fixed_ordinal
model_rownames_fixed_final <- model_rownames_fixed_ordinal
model_rownames_random_final <- model_rownames_random_ordinal
rows_to_pack_final <- rows_to_pack_ordinal
} else {
model_rows_random_final <- model_rows_random
model_rows_fixed_final <- model_rows_fixed
model_rownames_fixed_final <- model_rownames_fixed
model_rownames_random_final <- model_rownames_random
rows_to_pack_final <- rows_to_pack
}
all_models <- report_side_by_side(
pa_sub,
pa_obj_log,
mood,
reactance,
is_reactance,
model_rows_random = model_rows_random_final,
model_rows_fixed = model_rows_fixed_final,
model_rownames_random = model_rownames_random_final,
model_rownames_fixed = model_rownames_fixed_final
)
## [1] "pa_sub"
## [1] "pa_obj_log"
## [1] "mood"
## [1] "reactance"
## [1] "is_reactance"
# pretty printing
summary_all_models <- all_models %>%
print_df(rows_to_pack = rows_to_pack_final) %>%
add_header_above(
c(" ", "Subjective MVPA" = 2,
"Device-Based MVPA" = 2,
"Mood" = 2,
"Reactance Gaussian" = 2,
"Reactance Dichotome" = 2)
)
export_xlsx(summary_all_models,
rows_to_pack = rows_to_pack_final,
file.path("Output", "SensitivityCovariates", "AllCovariates_SensCovariates.xlsx"),
merge_option = 'both',
simplify_2nd_row = TRUE,
colwidths = c(40, 7.4, 12.85, 7.4, 12.85,7.4, 12.85,7.4, 12.85,7.4, 12.85),
line_above_rows = c(1,2,3,28),
line_below_rows = c(-1))
summary_all_models
|
|
Subjective MVPA
|
Device-Based MVPA
|
Mood
|
Reactance Gaussian
|
Reactance Dichotome
|
|
|
IRR pa_sub
|
95% CI pa_sub
|
exp(Est.) pa_obj_log
|
95% CI pa_obj_log
|
b mood
|
95% CI mood
|
b reactance
|
95% CI reactance
|
OR is_reactance
|
95% CI is_reactance
|
|
Intercept
|
31.94*
|
[20.58, 50.03]
|
113.71*
|
[100.07, 129.35]
|
5.05*
|
[ 4.78, 5.31]
|
0.58*
|
[ 0.26, 0.90]
|
8.00
|
[0.23, 379.95]
|
|
Within-Person Effects
|
|
Daily perceived persuasion target -> target
|
1.03
|
[ 0.91, 1.16]
|
0.99
|
[ 0.97, 1.02]
|
0.02
|
[-0.01, 0.05]
|
-0.01
|
[-0.06, 0.05]
|
0.79
|
[0.31, 1.90]
|
|
Daily perceived persuasion target -> agent
|
0.99
|
[ 0.88, 1.12]
|
1.02
|
[ 1.00, 1.04]
|
-0.02
|
[-0.05, 0.01]
|
0.00
|
[-0.07, 0.07]
|
0.89
|
[0.29, 2.70]
|
|
Daily perceived pressure target -> target
|
1.22
|
[ 0.92, 1.66]
|
1.00
|
[ 0.95, 1.05]
|
-0.02
|
[-0.09, 0.06]
|
-0.03
|
[-0.12, 0.07]
|
0.98
|
[0.21, 4.87]
|
|
Daily perceived pressure target -> agent
|
0.93
|
[ 0.72, 1.25]
|
0.96
|
[ 0.91, 1.02]
|
0.04
|
[-0.04, 0.11]
|
0.08
|
[-0.05, 0.20]
|
3.13
|
[0.45, 27.49]
|
|
Daily perceived pushing target -> target
|
1.05
|
[ 0.89, 1.24]
|
1.03*
|
[ 1.00, 1.07]
|
-0.03
|
[-0.08, 0.01]
|
-0.03
|
[-0.09, 0.03]
|
0.42
|
[0.13, 1.15]
|
|
Daily perceived pushing target -> agent
|
0.95
|
[ 0.80, 1.14]
|
0.98
|
[ 0.95, 1.02]
|
-0.02
|
[-0.06, 0.03]
|
0.01
|
[-0.07, 0.08]
|
1.10
|
[0.31, 3.90]
|
|
Day
|
0.91
|
[ 0.58, 1.42]
|
0.88*
|
[ 0.79, 1.00]
|
-0.06
|
[-0.27, 0.14]
|
-0.16
|
[-0.56, 0.22]
|
0.50
|
[0.00, 91.98]
|
|
Daily weartime
|
NA
|
NA
|
1.00
|
[ 1.00, 1.00]
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Daily perceived support target -> target
|
0.91*
|
[ 0.84, 0.99]
|
0.99
|
[ 0.97, 1.00]
|
-0.01
|
[-0.04, 0.01]
|
0.03
|
[-0.02, 0.09]
|
1.50
|
[0.65, 3.75]
|
|
Daily perceived support target -> agent
|
0.98
|
[ 0.90, 1.07]
|
1.00
|
[ 0.98, 1.01]
|
0.00
|
[-0.02, 0.03]
|
-0.01
|
[-0.06, 0.04]
|
0.76
|
[0.29, 1.85]
|
|
Is a weekend
|
1.03
|
[ 0.84, 1.27]
|
0.99
|
[ 0.95, 1.04]
|
0.06
|
[ 0.00, 0.13]
|
-0.15
|
[-0.31, 0.01]
|
0.10
|
[0.01, 1.25]
|
|
JITAI received
|
1.02
|
[ 0.78, 1.35]
|
0.96
|
[ 0.91, 1.02]
|
0.03
|
[-0.05, 0.10]
|
0.06
|
[-0.15, 0.27]
|
1.48
|
[0.05, 47.00]
|
|
Days post skilled support intervention
|
1.11
|
[ 0.78, 1.55]
|
1.10*
|
[ 1.01, 1.21]
|
-0.09
|
[-0.24, 0.07]
|
-0.01
|
[-0.28, 0.26]
|
0.26
|
[0.00, 11.29]
|
|
Between-Person Effects
|
|
Mean perceived persuasion target -> target
|
1.07
|
[ 0.63, 1.85]
|
0.91
|
[ 0.77, 1.08]
|
0.24
|
[-0.08, 0.56]
|
-0.16
|
[-0.54, 0.23]
|
0.21
|
[0.00, 28.89]
|
|
Mean Perceived persuasion target -> agent
|
1.12
|
[ 0.65, 1.94]
|
1.09
|
[ 0.91, 1.30]
|
0.05
|
[-0.26, 0.36]
|
0.12
|
[-0.27, 0.52]
|
7.60
|
[0.08, 854.29]
|
|
Mean Perceived pressure target -> target
|
1.50
|
[ 0.76, 3.00]
|
1.09
|
[ 0.86, 1.38]
|
0.13
|
[-0.24, 0.49]
|
0.23
|
[-0.20, 0.67]
|
5.42
|
[0.03, 1043.94]
|
|
Mean Perceived pressure target -> agent
|
0.68
|
[ 0.31, 1.46]
|
0.78*
|
[ 0.63, 0.97]
|
-0.18
|
[-0.56, 0.20]
|
-0.11
|
[-0.58, 0.37]
|
0.54
|
[0.00, 130.98]
|
|
Mean Perceived pushing target -> target
|
0.47
|
[ 0.19, 1.18]
|
0.99
|
[ 0.74, 1.32]
|
-0.40
|
[-0.93, 0.13]
|
-0.16
|
[-0.78, 0.44]
|
0.50
|
[0.00, 538.20]
|
|
Mean Perceived pushing target -> agent
|
0.63
|
[ 0.28, 1.43]
|
1.22
|
[ 0.95, 1.55]
|
-0.07
|
[-0.52, 0.39]
|
0.03
|
[-0.57, 0.63]
|
0.13
|
[0.00, 104.50]
|
|
Mean weartime
|
NA
|
NA
|
1.00*
|
[ 1.00, 1.00]
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Difference study group 2
|
0.80
|
[ 0.55, 1.18]
|
0.97
|
[ 0.87, 1.09]
|
-0.25*
|
[-0.47, -0.02]
|
-0.02
|
[-0.27, 0.23]
|
0.70
|
[0.02, 31.46]
|
|
Difference study group 3
|
0.71
|
[ 0.49, 1.04]
|
1.12
|
[ 0.99, 1.26]
|
-0.01
|
[-0.22, 0.20]
|
0.18
|
[-0.11, 0.46]
|
9.04
|
[0.16, 593.72]
|
|
Random Effects
|
|
sd(Intercept)
|
0.68
|
[ 0.50, 0.91]
|
0.27
|
[0.20, 0.35]
|
0.63
|
[0.49, 0.81]
|
0.58
|
[ 0.43, 0.77]
|
7.48
|
[ 5.31, 10.00]
|
|
sd(Daily perceived persuasion target -> target)
|
0.21
|
[ 0.06, 0.37]
|
0.06
|
[0.03, 0.09]
|
0.03
|
[0.00, 0.07]
|
0.06
|
[ 0.00, 0.15]
|
1.75
|
[ 0.32, 3.39]
|
|
sd(Daily perceived persuasion target -> agent)
|
0.18
|
[ 0.04, 0.33]
|
0.05
|
[0.03, 0.08]
|
0.05
|
[0.01, 0.11]
|
0.04
|
[ 0.00, 0.11]
|
1.45
|
[ 0.11, 3.24]
|
|
sd(Daily perceived pressure target -> target)
|
0.16
|
[ 0.01, 0.48]
|
0.06
|
[0.00, 0.15]
|
0.09
|
[0.00, 0.26]
|
0.44
|
[ 0.28, 0.67]
|
3.74
|
[ 1.63, 6.14]
|
|
sd(Daily perceived pressure target -> agent)
|
0.15
|
[ 0.01, 0.45]
|
0.04
|
[0.00, 0.10]
|
0.14
|
[0.01, 0.32]
|
0.23
|
[ 0.02, 0.59]
|
1.28
|
[ 0.05, 3.71]
|
|
sd(Daily perceived pushing target -> target)
|
0.25
|
[ 0.02, 0.53]
|
0.08
|
[0.01, 0.15]
|
0.09
|
[0.02, 0.16]
|
0.08
|
[ 0.00, 0.22]
|
0.93
|
[ 0.03, 2.55]
|
|
sd(Daily perceived pushing target -> agent)
|
0.15
|
[ 0.01, 0.37]
|
0.03
|
[0.00, 0.09]
|
0.08
|
[0.01, 0.17]
|
0.04
|
[ 0.00, 0.14]
|
0.96
|
[ 0.04, 2.70]
|
|
Additional Parameters
|
|
ar[1]
|
0.02
|
[-0.94, 0.94]
|
0.28
|
[0.24, 0.31]
|
0.45
|
[0.42, 0.48]
|
0.01
|
[-0.07, 0.10]
|
0.14
|
[-0.06, 0.34]
|
|
nu
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
shape
|
0.14
|
[ 0.13, 0.14]
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
sderr
|
0.05
|
[ 0.00, 0.13]
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
9.86
|
[ 6.33, 14.34]
|
|
sigma
|
NA
|
NA
|
0.55
|
[0.54, 0.57]
|
0.87
|
[0.85, 0.89]
|
0.94
|
[ 0.89, 1.00]
|
NA
|
NA
|
Analyses were conducted using the R Statistical language (version
4.4.1; R Core Team, 2024) on Windows 11 x64 (build 22635)
- Allaire J, Xie Y, Dervieux C, McPherson J, Luraschi J, Ushey K,
Atkins A, Wickham H, Cheng J, Chang W, Iannone R (2024). rmarkdown:
Dynamic Documents for R. R package version 2.28, https://github.com/rstudio/rmarkdown. Xie Y, Allaire J,
Grolemund G (2018). R Markdown: The Definitive Guide. Chapman
and Hall/CRC, Boca Raton, Florida. ISBN 9781138359338, https://bookdown.org/yihui/rmarkdown. Xie Y, Dervieux C,
Riederer E (2020). R Markdown Cookbook. Chapman and Hall/CRC,
Boca Raton, Florida. ISBN 9780367563837, https://bookdown.org/yihui/rmarkdown-cookbook.
- Bååth R (2024). beepr: Easily Play Notification Sounds on any
Platform. R package version 2.0, https://github.com/rasmusab/beepr.
- Bengtsson H (2003). “The R.oo package - Object-Oriented Programming
with References Using Standard R Code.” In Hornik K, Leisch F, Zeileis A
(eds.), Proceedings of the 3rd International Workshop on Distributed
Statistical Computing (DSC 2003). https://www.r-project.org/conferences/DSC-2003/Proceedings/Bengtsson.pdf.
- Bengtsson H (2003). “The R.oo package - Object-Oriented Programming
with References Using Standard R Code.” In Hornik K, Leisch F, Zeileis A
(eds.), Proceedings of the 3rd International Workshop on Distributed
Statistical Computing (DSC 2003). https://www.r-project.org/conferences/DSC-2003/Proceedings/Bengtsson.pdf.
- Bengtsson H (2023). R.utils: Various Programming Utilities.
R package version 2.12.3, https://github.com/HenrikBengtsson/R.utils, https://henrikbengtsson.github.io/R.utils/.
- Bürkner P (2017). “brms: An R Package for Bayesian Multilevel Models
Using Stan.” Journal of Statistical Software, 80(1),
1-28. doi:10.18637/jss.v080.i01 https://doi.org/10.18637/jss.v080.i01. Bürkner P (2018).
“Advanced Bayesian Multilevel Modeling with the R Package brms.” The
R Journal, 10(1), 395-411. doi:10.32614/RJ-2018-017
https://doi.org/10.32614/RJ-2018-017. Bürkner P (2021).
“Bayesian Item Response Modeling in R with brms and Stan.” Journal
of Statistical Software, 100(5), 1-54. doi:10.18637/jss.v100.i05 https://doi.org/10.18637/jss.v100.i05.
- Eddelbuettel D, Francois R, Allaire J, Ushey K, Kou Q, Russell N,
Ucar I, Bates D, Chambers J (2024). Rcpp: Seamless R and C++
Integration. R package version 1.0.13, https://dirk.eddelbuettel.com/code/rcpp.html, https://github.com/RcppCore/Rcpp, https://www.rcpp.org.
Eddelbuettel D, François R (2011). “Rcpp: Seamless R and C++
Integration.” Journal of Statistical Software, 40(8),
1-18. doi:10.18637/jss.v040.i08 https://doi.org/10.18637/jss.v040.i08. Eddelbuettel D
(2013). Seamless R and C++ Integration with Rcpp. Springer, New
York. doi:10.1007/978-1-4614-6868-4 https://doi.org/10.1007/978-1-4614-6868-4, ISBN
978-1-4614-6867-7. Eddelbuettel D, Balamuta J (2018). “Extending R with
C++: A Brief Introduction to Rcpp.” The American Statistician,
72(1), 28-36. doi:10.1080/00031305.2017.1375990 https://doi.org/10.1080/00031305.2017.1375990.
- Gabry J, Mahr T (2024). “bayesplot: Plotting for Bayesian Models.” R
package version 1.11.1, https://mc-stan.org/bayesplot/. Gabry J, Simpson D,
Vehtari A, Betancourt M, Gelman A (2019). “Visualization in Bayesian
workflow.” J. R. Stat. Soc. A, 182, 389-402. doi:10.1111/rssa.12378 https://doi.org/10.1111/rssa.12378.
- Grolemund G, Wickham H (2011). “Dates and Times Made Easy with
lubridate.” Journal of Statistical Software, 40(3),
1-25. https://www.jstatsoft.org/v40/i03/.
- Hester J, Wickham H, Csárdi G (2024). fs: Cross-Platform File
System Operations Based on ‘libuv’. R package version 1.6.4, https://github.com/r-lib/fs, https://fs.r-lib.org.
- Küng P (2023). wbCorr: Bivariate Within- and Between-Cluster
Correlations. University of Zürich. R package version 0.1.22. https://github.com/Pascal-Kueng/wbCorr.
- Müller K, Wickham H (2023). tibble: Simple Data Frames. R
package version 3.2.1, https://github.com/tidyverse/tibble, https://tibble.tidyverse.org/.
- R Core Team (2024). R: A Language and Environment for
Statistical Computing. R Foundation for Statistical Computing,
Vienna, Austria. https://www.R-project.org/.
- Schauberger P, Walker A (2024). openxlsx: Read, Write and Edit
xlsx Files. R package version 4.2.7.1, https://github.com/ycphs/openxlsx, https://ycphs.github.io/openxlsx/index.html.
- Wickham H (2016). ggplot2: Elegant Graphics for Data
Analysis. Springer-Verlag New York. ISBN 978-3-319-24277-4, https://ggplot2.tidyverse.org.
- Wickham H (2023). forcats: Tools for Working with Categorical
Variables (Factors). R package version 1.0.0, https://github.com/tidyverse/forcats, https://forcats.tidyverse.org/.
- Wickham H (2023). stringr: Simple, Consistent Wrappers for
Common String Operations. R package version 1.5.1, https://github.com/tidyverse/stringr, https://stringr.tidyverse.org.
- Wickham H (2024). rvest: Easily Harvest (Scrape) Web Pages.
R package version 1.0.4, https://github.com/tidyverse/rvest, https://rvest.tidyverse.org/.
- Wickham H, Averick M, Bryan J, Chang W, McGowan LD, François R,
Grolemund G, Hayes A, Henry L, Hester J, Kuhn M, Pedersen TL, Miller E,
Bache SM, Müller K, Ooms J, Robinson D, Seidel DP, Spinu V, Takahashi K,
Vaughan D, Wilke C, Woo K, Yutani H (2019). “Welcome to the tidyverse.”
Journal of Open Source Software, 4(43), 1686. doi:10.21105/joss.01686
https://doi.org/10.21105/joss.01686.
- Wickham H, Bryan J (2023). readxl: Read Excel Files. R
package version 1.4.3, https://github.com/tidyverse/readxl, https://readxl.tidyverse.org.
- Wickham H, François R, Henry L, Müller K, Vaughan D (2023).
dplyr: A Grammar of Data Manipulation. R package version 1.1.4,
https://github.com/tidyverse/dplyr, https://dplyr.tidyverse.org.
- Wickham H, Henry L (2023). purrr: Functional Programming
Tools. R package version 1.0.2, https://github.com/tidyverse/purrr, https://purrr.tidyverse.org/.
- Wickham H, Hester J, Bryan J (2024). readr: Read Rectangular
Text Data. R package version 2.1.5, https://github.com/tidyverse/readr, https://readr.tidyverse.org.
- Wickham H, Hester J, Ooms J (2023). xml2: Parse XML. R
package version 1.3.6, https://github.com/r-lib/xml2, https://xml2.r-lib.org/.
- Wickham H, Vaughan D, Girlich M (2024). tidyr: Tidy Messy
Data. R package version 1.3.1, https://github.com/tidyverse/tidyr, https://tidyr.tidyverse.org.
- Xie Y (2024). knitr: A General-Purpose Package for Dynamic
Report Generation in R. R package version 1.48, https://yihui.org/knitr/. Xie Y (2015). Dynamic
Documents with R and knitr, 2nd edition. Chapman and Hall/CRC, Boca
Raton, Florida. ISBN 978-1498716963, https://yihui.org/knitr/. Xie Y (2014). “knitr: A
Comprehensive Tool for Reproducible Research in R.” In Stodden V, Leisch
F, Peng RD (eds.), Implementing Reproducible Computational
Research. Chapman and Hall/CRC. ISBN 978-1466561595.
- Zhu H (2024). kableExtra: Construct Complex Table with ‘kable’
and Pipe Syntax. R package version 1.4.0, https://github.com/haozhu233/kableExtra, http://haozhu233.github.io/kableExtra/.